import java.util.Scanner;

public class Allroads {
    public void allroads(){
        Main m = new Main();
        System.out.println("————————————————————————————————————————————");
        System.out.println("请输入要查找的起始点和终止点：");
        int start = 0,end = 0;
        Scanner sc = new Scanner(System.in);
        switch (sc.next()) {
            case "合肥":
                start = 0;
                break;
            case "北京":
                start = 1;
                break;
            case "上海":
                start = 2;
                break;
            case "重庆":
                start = 3;
                break;
            case "广州":
                start = 4;
                break;
            case "南京":
                start = 5;
                break;
            case "深圳":
                start = 6;
                break;
            case "桂林":
                start = 7;
                break;
            case "昆明":
                start = 8;
                break;
            case "西安":
                start = 9;
                break;
            default:
                System.out.println("请输入合肥、北京、上海、重庆、广州、南京、深圳、桂林、昆明、西安中的两座城市。");
                break;
        }
        switch (sc.next()) {
            case "合肥":
                end = 0;
                break;
            case "北京":
                end = 1;
                break;
            case "上海":
                end = 2;
                break;
            case "重庆":
                end = 3;
                break;
            case "广州":
                end = 4;
                break;
            case "南京":
                end = 5;
                break;
            case "深圳":
                end = 6;
                break;
            case "桂林":
                end = 7;
                break;
            case "昆明":
                end = 8;
                break;
            case "西安":
                end = 9;
                break;
            default:
                System.out.println("请输入合肥、北京、上海、重庆、广州、南京、深圳、桂林、昆明、西安中的两座城市。");
                break;
        }
        AllRoads3 a = new AllRoads3();
        a.dfs(start,end);
        System.out.println("这两地的所有路径为:");
        for (int i = 0; i < a.ans.size(); i++) {
            System.out.println(a.ans.get(i).toString().replace("A","合肥").replace("B","北京")
                    .replace("C","上海").replace("D","重庆").replace("E","广州")
                    .replace("F","南京").replace("G","深圳").replace("H","桂林")
                    .replace("I","昆明").replace("J","西安"));
        }
        System.out.println("————————————————————————————————————————————");
        System.out.println("（1）返回\t\t（2）退出");
        int j = sc.nextInt();
        switch (j) {
            case 1:
                m.menu();
            case 2:
                break;
            default:
                System.out.println("请输入1、2进行选择。");
                break;
        }
    }
}
